/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package interfaces;

import java.util.Iterator;

/**
 *
 * @author Daryna_Ragimova
 */
public interface MyMap<K,V> {
    /**
     * removes all of the mappings from this map.
     */
    void clear();
    /**
     * @param key - the key for searching
     * @return true if this map contains a mapping for the specified key otherwise - false
     */
    boolean containsKey(Object key);
    /**
     * 
     * @param value - the value for searching   
     * @return returns true if this map maps one or more keys to the specified value, otherwise - false
     */
    boolean containsValue(Object value);
    /**
     * 
     * @param key - key, for which you want to find value
     * @return the value to which the specified key is mapped, or null if this map contains no mapping for the key
     */
    V get(Object key);
    /**
     * 
     * @return true if this map contains no key-value mappings
     */
    boolean isEmpty();
    /**
     * associates the specified value with the specified key in this map
     * @param key - key with which the specified value is to be associated
     * @param value -  value to be associated with the specified key
     * @return  - the previous value associated with key, or null if there was no mapping for key.
     */
    V put(K key, V value);
    /**
     * removes the mapping for the specified key from this map if present
     * @param key - key whose mapping is to be removed from the map
     * @return the previous value associated with key, or null if there was no mapping for key.
     */
    V remove(K key);
    /**
     * @return the number of key-value mappings in this map
     */
    int size();
    /**
     * @return an iterator over the elements (MyMap.Entry) in proper sequence
     */
    Iterator<Entry<K,V>> entryIterator();
    
    public interface Entry<K,V>{
        /**
         * сompares the specified object with this entry for equality
         * @param o
         * @return rue if the specified object is equal to this map entry
         */
        boolean equals(Object o);
        /**
         * @return the key corresponding to this entry
         */
        K getKey();
        /**
         *@return the value corresponding to this entry
         */
        V getValue();
        /**
         *@return the hash code value for this map entry
         */
        int hashCode();
        /**
         * replaces the value corresponding to this entry with the specified value
         * @param value - new value to be stored in this entry
         * @return old value corresponding to this key
         */
        V setValue(V value);
        
    }
}
